import React from 'react';
import { Form, Row, Col } from 'antd';
import { EmployeeSelect } from '@/containers';
import { renderFormText } from '@/utils/utils';

const ProfileProxy = ({ form, employeeCode, initialData = {} }) => {
    const { getFieldDecorator } = form;
    const {
        administrativeOrganizationName,
        fullOrganizationName,
        dutyAlias,
        rankValue,
        leaderName,
        chargeNumber,
        partTimeDuty,
        timeOfEntry
    } = initialData;

    return (
        <Row>
            <Row>
                <Col span={12}>
                    <Form.Item label="姓名">
                        {getFieldDecorator('leaverEmployeeCode', {
                            initialValue: employeeCode,
                            rules: [{ required: true, message: '请输入姓名' }]
                        })(<EmployeeSelect popupForBody />)}
                    </Form.Item>
                </Col>
                <Col span={12}>
                    <Form.Item label="行政机构">{renderFormText(administrativeOrganizationName)}</Form.Item>
                </Col>
            </Row>
            <Row>
                <Col span={12}>
                    <Form.Item label="组织机构">{renderFormText(fullOrganizationName)}</Form.Item>
                </Col>
                <Col span={12}>
                    <Form.Item label="岗位/职级">{`${renderFormText(dutyAlias)}/${renderFormText(
                        rankValue
                    )}`}</Form.Item>
                </Col>
            </Row>
            <Row>
                <Col span={12}>
                    <Form.Item label="直接上级">{renderFormText(leaderName)}</Form.Item>
                </Col>
                <Col span={12}>
                    <Form.Item label="分管下属">{renderFormText(chargeNumber)}</Form.Item>
                </Col>
            </Row>
            <Row>
                <Col span={12}>
                    <Form.Item label="兼任">{renderFormText(partTimeDuty)}</Form.Item>
                </Col>
                <Col span={12}>
                    <Form.Item label="入职日期">{renderFormText(timeOfEntry)}</Form.Item>
                </Col>
            </Row>
        </Row>
    );
};

export default ProfileProxy;
